q=load('results.mat');

order = 3;
framelen = 11;
timeslot_1 = 3000;
episode_1 = 10;

y1=zeros(timeslot_1,1);
for j=1:timeslot_1
    for i=1:episode_1
        y1(j)= y1(j)+q.RMSE(i,j);
    end
    y1(j)=y1(j)/episode_1;
end

y1=sgolayfilt(y1,order,framelen);
figure(1)
plot(1:timeslot_1,y1,'k');
grid on;
xlabel('Time slot')
ylabel('RMSE(m)')
legend('RUWL');
saveas(gcf,'RMSE.emf')

y1=zeros(timeslot_1,1);
for j=1:timeslot_1
    for i=1:episode_1
        y1(j)= y1(j)+q.Energy_Consumption(i,j);
    end
    y1(j)=y1(j)/episode_1;
end

y1=sgolayfilt(y1,order,framelen);
figure(2)
plot(1:timeslot_1,y1,'k');
grid on;
xlabel('Time slot')
ylabel('Energy Comsumption(mJ)')
legend('RUWL');
saveas(gcf,'Energy Comsumption.emf')

y1=zeros(timeslot_1,1);
for j=1:timeslot_1
    for i=1:episode_1
        y1(j)= y1(j)+q.Utility(i,j);
    end
    y1(j)=y1(j)/episode_1;
end

y1=sgolayfilt(y1,order,framelen);
figure(3)
plot(1:timeslot_1,y1,'k');
grid on;
xlabel('Time slot')
ylabel('Utility')
legend('RUWL');
saveas(gcf,'Utility.emf')

